<?php
	@session_start();
	include("../../connect/connect_mysql.php");
	
	$act= $_POST["act"];
 	switch($act){
 		case 'image_collection':
 			$id= 3;	
 		break;
		case 'image_event':
 			$id = 5;
		break;
		case 'image_banner':
			$id= 7;
 		break;
 		case 'image_header':
			$id= 8;
 		break;
 		case 'image_gallery':
			$id= 9;
 		break;
 		case 'image_onpress':
			$id= 10;
 		break;
		case 'image_menu':
			$id= 2;
 		break;
 	}

 		$images= $_POST['ids'];
 		$comment = $_POST['comment'];
 		$img = preg_split("/[,]/",$images);
 		$com = preg_split("/[#]/",$comment);
 		$len = count($img);
 		for ($i = 0 ;$i < $len ; $i++){
 			$c = str_replace("\n", ".-", $com[$i]);
 			$query ="UPDATE `image` SET `comment`= '$c' WHERE `page_id`= '$id' and `image_id`='$img[$i]';";
			mysql_query ("SET NAMES 'utf8'");
			mysql_query($query); 		
 		}
 		echo 1;
?>
